import router from '../../router'
import store from '../../store/store'

export default{
    log (message, toConsole){
        console.log('log...',message,toConsole);
    },
    showChatMessage(p,options){
        var isme = (p.from == IMSDK.getLoginInfo().loginUserId) ? true : false;
            var msg = {
                "time": new Date(),
                "message": p.dataContent,
                "self": isme
            } 
        store.state.sessin.push(msg);
        console.log('p', p.dataContent)
        console.log('options',options)
        console.log('showChatMessage....')
      },
    afterLoginSucess(){ //登录成功！！
        console.log('登录成功了');
        router.push('/msg');
    },
    afterLoginSucessFailed(isReconnect){ //登录或重连回调
        console.log('对不起，你'+(isReconnect?'自动重连':'登陆')+'IM服务器失败了 ...', false);
      },
    afterDisconnected(){ //与IM服务端的网络连接断开时要调用的函数。
        console.log('Sorry，你掉线了 ...', false);
      },
    afterReconnectSucess(){ //掉线重连成功时要调用的函数。
        console.log('掉线自动重连成功了！', false);
    }
}